<?php
namespace app\common\controller;

use app\BaseController;
use think\facade\View;

class Home extends BaseController
{
    public function initialize()
    {
        parent::initialize();
        define('ISPJAX', request()->isPjax());
        define('ISMOBILE', request()->isMobile());
        define('CONTROLLER_NAME', request()->controller());
        define('ACTION_NAME', request()->action());
        View::assign('page_title', config('dbconfig.web.title'));
        self::saveUrlShareCode();
    }

    /*
     *  接收链接中的邀请码
     * */
    public function saveUrlShareCode(){
        $p_share_code = $this->request->param('pcode','');
        if(empty($p_share_code)) return false;
        session('p_share_code', $p_share_code);
        return true;
    }

    /*
     *  获取邀请码
     * */
    public function getPShareCode(){
        return session('p_share_code');
    }
}